import axios from './index'

const preUrl = ''


// 获取玩家列表
const getPlayerList = {
  p: [`get,/player/*/list/*`],
  r: params => {
    axios.defaults.headers.permission = `get,/player/*/list/*`
    return axios.get(`${preUrl}/player/${Cookie.get('areaCode')}/list`, {
      params
    })
  }
}


// 搜索玩家列表
const searchPlayerList = {
  p: [`get,/player/*/conditions/*`],
  r: params => {
    axios.defaults.headers.permission = `get,/player/*/conditions/*`
    return axios.get(`${preUrl}/player/${Cookie.get('areaCode')}/conditions`, {
      params
    })
  }
}

// 修改玩家钻石数
const editDiamond = {
  p: [`put,/user/manager/*/amount`],
  r: params => {
    axios.defaults.headers.permission = `put,/user/manager/*/amount`
    return axios.put(`${preUrl}/user/manager/${Cookie.get('areaCode')}/amount`, params)
  }
}

// 修改玩家钻石数
const editLftid = {
  p: [`put,/user/manager/*`],
  r: params => {
    axios.defaults.headers.permission = `put,/user/manager/*`
    return axios.put(`${preUrl}/user/manager/${Cookie.get('areaCode')}`, params)
  }
}


// 获取玩家充值记录
const getPlayerTopup = {
  p: [`get,/player/*/topuplist/*`],
  r: params => {
    axios.defaults.headers.permission = `get,/player/*/topuplist/*`
    return axios.get(`${preUrl}/player/${Cookie.get('areaCode')}/topuplist`, {
      params
    })
  }
}


// 获取玩家详情
const getPlayerDetails = {
  p: [`get,/player/*/*`],
  r: params => {
    axios.defaults.headers.permission = `get,/player/*/*`
    return axios.get(`${preUrl}/player/${Cookie.get('areaCode')}/${params}`)
  }
}

// 获取玩家游戏统计
const getPlayerGame = {
  p: [`get,/player/*/gameList/**`],
  r: params => {
    axios.defaults.headers.permission = `get,/player/*/gameList/**`
    return axios.get(`${preUrl}/player/${Cookie.get('areaCode')}/gameList`, {
      params
    })
  }
}

// 获取玩家俱乐部统计
const getPlayerClub = {
  p: [`get,/player/*/crowdList/**`],
  r: params => {
    axios.defaults.headers.permission = `get,/player/*/crowdList/**`
    return axios.get(`${preUrl}/player/${Cookie.get('areaCode')}/crowdList`, {
      params
    })
  }
}


// 获取全充值查询卡片
const getTopupCard = {
  p: [`get,/player/*/topupTime`],
  r: params => {
    axios.defaults.headers.permission = `get,/player/*/topupTime`
    return axios.get(`${preUrl}/player/${Cookie.get('areaCode')}/topupTime`)
  }
}

// 获取全充值查询统计
const getPlayersTopup = {
  p: [`get,/player/*/topupInfo/**`],
  r: params => {
    axios.defaults.headers.permission = `get,/player/*/topupInfo/**`
    return axios.get(`${preUrl}/player/${Cookie.get('areaCode')}/topupInfo`, {
      params
    })
  }
}

// 获取单充值查询统计
const getTopupDetails = {
  p: [`get,/player/*/topupDetail/**`],
  r: params => {
    axios.defaults.headers.permission = `get,/player/*/topupDetail/**`
    return axios.get(`${preUrl}/player/${Cookie.get('areaCode')}/topupDetail`, {
      params
    })
  }
}

// 搜索单充值查询统计
const searchTopupDetails = {
  p: [`get,/player/*/orderList/**`],
  r: params => {
    axios.defaults.headers.permission = `get,/player/*/orderList/**`
    return axios.get(`${preUrl}/player/${Cookie.get('areaCode')}/orderList`, {
      params
    })
  }
}

// 尝试发货
const deliverGoods = {
  p: [`get,/order/*/*`],
  r: orderNo => {
    axios.defaults.headers.permission = `get,/order/*/*`
    return axios.get(`${preUrl}/order/${Cookie.get('areaCode')}/${orderNo}`)
  }
}


export {
  getPlayerList,
  editDiamond,
  editLftid,
  searchPlayerList,
  getPlayerTopup,
  getPlayerDetails,
  getPlayerGame,
  getPlayerClub,
  getTopupCard,
  getPlayersTopup,
  getTopupDetails,
  searchTopupDetails,
  deliverGoods,
}